home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 June: Reference Library / Dev.CD Jun 95 / Dev.CD Jun 95.toast / What's New? / New System Software Extensions / QuickDraw 3D ß / Programming / Interfaces / QD3D.h next >
Encoding:
C/C++ Source or Header  |  1995-04-12  |  30.6 KB  |  927 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                              **
  3.  **     Module:        QD3D.h                                                     **                        
  4.  **                                                                              **
  5.  **                                                                              **
  6.  **     Purpose:     System include file.                                     **            
  7.  **                                                                              **
  8.  **                                                                              **
  9.  **     Copyright (C) 1992-1995 Apple Computer, Inc.  All rights reserved.     **
  10.  **                                                                              **
  11.  **                                                                              **
  12.  *****************************************************************************/
  13. #ifndef QD3D_h
  14. #define QD3D_h
  15.  
  16. #include <stdio.h>
  17.  
  18. /******************************************************************************
  19.  **                                                                             **
  20.  **                                Porting Control                                 **
  21.  **                                                                             **
  22.  *****************************************************************************/
  23.  
  24. #ifndef OS_MACINTOSH
  25.  
  26.     #define OS_MACINTOSH                1
  27.     #define WINDOW_SYSTEM_MACINTOSH        1
  28.  
  29.     #if defined(THINK_C) || defined(THINK_CPLUS) || defined(__MWERKS__)
  30.          #define PRAGMA_ONCE                1
  31.     #else
  32.          #define PRAGMA_ONCE                0
  33.     #endif  /*  defined(THINK_C) || defined(THINK_CPLUS) || defined(__MWERKS__)  */
  34.  
  35.     /*
  36.      * Set required compiler options (if possible):
  37.      *   1. enums must always be ints in QD3D and in applications;
  38.      *      this consistency is required to prevent misinterpretation
  39.      *      of an app's enum values by an API; it is also required for
  40.      *      compliance with ANSI
  41.      *   2. alignment of char and short arrays in structures is not on
  42.      *      long boundaries; (could be other way, but must be consistent
  43.      *      in QD3D and in applications)
  44.      *   3. alignment of longs, floats, and pointers in structures
  45.      *      is on long boundaries for PowerPC
  46.      */
  47.     #if defined(THINK_C) || defined(THINK_CPLUS)
  48.         #pragma options(!pack_enums, !align_arrays)
  49.     #elif defined(__MWERKS__)
  50.         #pragma enumsalwaysint on
  51.         #pragma align_array_members off
  52.         #pragma options align=native
  53.     #elif defined(__PPCC__)
  54.         #pragma options align=power
  55.     #endif
  56.     
  57.     enum {
  58.         gestaltQD3D                = 'qd3d',
  59.         gestaltQD3DNotPresent    = 0,
  60.         gestaltQD3DAvailable    = 1
  61.     };
  62.     
  63. #endif  /*  OS_MACINTOSH  */
  64.  
  65. #if defined(_WIN32) && _WIN32
  66.     #define WINDOW_SYSTEM_WINDOWS        1
  67. #endif  /*  defined(_WIN32) && _WIN32  */
  68.  
  69. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  70.     #pragma once
  71. #endif  /*  PRAGMA_ONCE  */
  72.  
  73. /*
  74.  *  NOTE:  To compile on a Unix workstation (assumes X11 window system):
  75.  *                1. Add to compiler command line: "-DOS_MACINTOSH=0"
  76.  *                2. Add "-DOS_UNIX=1"
  77.  *                3. Add "-DWINDOW_SYSTEM_X11=1"
  78.  */
  79.     
  80. /*
  81.  *  NOTE:  To compile on a DOS/WINDOWS machine:
  82.  *                1. Add to compiler command line: "-DOS_MACINTOSH=0"
  83.  *                2. Add "-DOS_WINDOWS=1"
  84.  *                3. Add "-DWINDOW_SYSTEM_WINDOWS=1"
  85.  */
  86.  
  87.  
  88. /******************************************************************************
  89.  **                                                                             **
  90.  **                                Export Control                                 **
  91.  **                                                                             **
  92.  *****************************************************************************/
  93.  
  94. #if defined(_MSC_VER)    /* Microsoft Visual C */
  95.     #define EXPORT        __declspec( dllexport )
  96. #else
  97.     #define EXPORT
  98. #endif  /*  _MSC_VER  */
  99.  
  100.  
  101. /******************************************************************************
  102.  **                                                                             **
  103.  **                                NULL definition                                 **
  104.  **                                                                             **
  105.  *****************************************************************************/
  106.  
  107. #ifndef NULL
  108. #error /*    NULL is undefined?    */
  109. #endif /* NULL */
  110.  
  111.  
  112. /******************************************************************************
  113.  **                                                                             **
  114.  **                                    Objects                                     **
  115.  **                                                                             **
  116.  *****************************************************************************/
  117. /*
  118.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  119.  * deletion, duplication, and i/o methods.
  120.  */
  121. typedef long                    TQ3ObjectType;
  122.  
  123. typedef struct TQ3ObjectPrivate    *TQ3Object;
  124.  
  125. /*
  126.  * There are four subclasses of OBJECT:
  127.  *    an ELEMENT, which is data that is placed in a SET
  128.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  129.  *    VIEWs, which maintain state information for an image
  130.  *    a PICK, which used to query a VIEW
  131.  */
  132. typedef TQ3Object                TQ3ElementObject;
  133. typedef TQ3Object                TQ3SharedObject;
  134. typedef TQ3Object                TQ3ViewObject;
  135. typedef TQ3Object                TQ3PickObject;
  136.  
  137. /*
  138.  * There are several types of SharedObjects:
  139.  *    RENDERERs, which paint to a drawContext
  140.  *    DRAWCONTEXTs, which are an interface to a device (not defined here)
  141.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  142.  *    FILEs, which maintain state information for a metafile
  143.  *    REFERENCEs, which contain references to objects in FILEs
  144.  *    SHAPEs, which affect the state of the View
  145.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  146.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  147.  *    TRACKERs, which represent a position and orientation in the user interface
  148.  *  STRINGs, which are abstractions of text string data.
  149.  *    STORAGE, which is an abstraction for stream-based data storage (files, memory)
  150.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  151.  */
  152. typedef TQ3SharedObject            TQ3RendererObject;
  153. typedef TQ3SharedObject            TQ3DrawContextObject;
  154. typedef TQ3SharedObject            TQ3SetObject;
  155. typedef TQ3SharedObject            TQ3FileObject;
  156. typedef TQ3SharedObject            TQ3ReferenceObject;
  157. typedef TQ3SharedObject            TQ3ShapeObject;
  158. typedef TQ3SharedObject            TQ3ShapePartObject;
  159. typedef TQ3SharedObject            TQ3ControllerStateObject;
  160. typedef TQ3SharedObject            TQ3TrackerObject;
  161. typedef TQ3SharedObject            TQ3StringObject;
  162. typedef TQ3SharedObject            TQ3StorageObject;
  163. typedef TQ3SharedObject            TQ3TextureObject;
  164.  
  165. #if defined(ESCHER_VER_15) && ESCHER_VER_15
  166. /*
  167.  * (and for QuickDraw 3D 1.5)
  168.  *    COLORSCHEMEs, which determine colors of user interface objects
  169.  *    DEEPBUFFERs, which cache a lot of rasterized information for
  170.  *  deferred interactive imaging.
  171.  *    WIDGETs, for interacting with objects in a view
  172.  *    ATTACHMENTs, for adding parametrizations to geometries
  173.  */
  174. typedef TQ3SharedObject            TQ3ColorSchemeObject;
  175. typedef TQ3SharedObject            TQ3DeepBufferObject;
  176. typedef TQ3SharedObject            TQ3WidgetObject;
  177. typedef TQ3SharedObject            TQ3AttachmentObject;
  178. #endif  /*  ESCHER_VER_15  */
  179.  
  180. /*
  181.  * There is one type of VIEW:
  182.  *    UIVIEWs, which provide interactive facilities
  183.  */
  184. #if defined(ESCHER_VER_15) && ESCHER_VER_15
  185. typedef TQ3ViewObject            TQ3UIViewObject;
  186. #endif  /*  ESCHER_VER_15  */
  187.  
  188. /*
  189.  * There is one types of SET:
  190.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited and interpolated
  191.  */
  192. typedef TQ3SetObject                TQ3AttributeSet;
  193.  
  194. /*
  195.  * There are many types of SHAPEs:
  196.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  197.  *    CAMERAs, which affects the location and orientation of the RENDERER in space
  198.  *    GROUPs, which may contain any number of SHARED OBJECTS
  199.  *    GEOMETRYs, which are representations of three-dimensional data
  200.  *    SHADERs, which affect how colors are drawn on a geometry
  201.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  202.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  203.  *  UNKNOWN, which hold unknown objects read from a metafile.
  204.  */
  205. typedef TQ3ShapeObject            TQ3GroupObject;
  206. typedef TQ3ShapeObject            TQ3GeometryObject;
  207. typedef TQ3ShapeObject            TQ3ShaderObject;
  208. typedef TQ3ShapeObject            TQ3StyleObject;
  209. typedef TQ3ShapeObject            TQ3TransformObject;
  210. typedef TQ3ShapeObject            TQ3LightObject;
  211. typedef TQ3ShapeObject            TQ3CameraObject;
  212. typedef TQ3ShapeObject            TQ3UnknownObject;
  213.  
  214. /*
  215.  * For now, there is only one type of SHAPEPARTs:
  216.  *    MESHPARTs, which describe some part of a mesh
  217.  */
  218. typedef TQ3ShapePartObject        TQ3MeshPartObject;
  219.  
  220. /*
  221.  * There are three types of MESHPARTs:
  222.  *    MESHFACEPARTs, which describe a face of a mesh
  223.  *    MESHEDGEPARTs, which describe a edge of a mesh
  224.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  225.  */
  226. typedef TQ3MeshPartObject        TQ3MeshFacePartObject;
  227. typedef TQ3MeshPartObject        TQ3MeshEdgePartObject;
  228. typedef TQ3MeshPartObject        TQ3MeshVertexPartObject;
  229.  
  230. /*
  231.  * A DISPLAY Group can be drawn to a view
  232.  */
  233. typedef TQ3GroupObject            TQ3DisplayGroupObject;
  234.  
  235. /*
  236.  * There are many types of SHADERs:
  237.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  238.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  239.  */
  240. typedef TQ3ShaderObject            TQ3SurfaceShaderObject;
  241. typedef TQ3ShaderObject            TQ3IlluminationShaderObject;
  242.  
  243. /*
  244.  * A handle to an object in a group
  245.  */
  246. typedef struct TQ3GroupPositionPrivate    *TQ3GroupPosition;
  247.  
  248.  
  249. /******************************************************************************
  250.  **                                                                             **
  251.  **                            Client/Server Things                             **
  252.  **                                                                             **
  253.  *****************************************************************************/
  254.  
  255. typedef void *TQ3ControllerRef;
  256.  
  257.  
  258. /******************************************************************************
  259.  **                                                                             **
  260.  **                            Flags and Switches                                 **
  261.  **                                                                             **
  262.  *****************************************************************************/
  263.  
  264. typedef enum TQ3Boolean {
  265.     kQ3False,
  266.     kQ3True
  267. } TQ3Boolean;
  268.  
  269. typedef enum TQ3Switch {
  270.     kQ3Off,
  271.     kQ3On
  272. } TQ3Switch;
  273.  
  274. typedef enum TQ3Status {
  275.     kQ3Failure,
  276.     kQ3Success
  277. } TQ3Status;
  278.  
  279. typedef enum TQ3SideMasks {
  280.     kQ3SideNone            = 0,
  281.     kQ3SideMaskFront    = 1 << 0,
  282.     kQ3SideMaskBack        = 1 << 1
  283. } TQ3SideMasks;
  284.  
  285. typedef unsigned long TQ3Side;
  286.  
  287. typedef enum TQ3Axis {
  288.     kQ3AxisX,
  289.     kQ3AxisY,
  290.     kQ3AxisZ
  291. } TQ3Axis;
  292.  
  293. typedef enum TQ3PixelType {
  294.     kQ3PixelTypeRGB32,
  295.     kQ3PixelTypeRGB24,
  296.     kQ3PixelTypeRGB16,
  297.     kQ3PixelTypeRGB8
  298. } TQ3PixelType;
  299.  
  300. typedef enum TQ3Endian{
  301.     kQ3EndianBig,
  302.     kQ3EndianLittle
  303. } TQ3Endian;
  304.  
  305. typedef enum TQ3EndCapMasks {
  306.     kQ3EndCapNone            = 0,
  307.     kQ3EndCapMaskTop        = 1 << 0,
  308.     kQ3EndCapMaskBottom        = 1 << 1
  309. } TQ3EndCapMasks;
  310.  
  311. typedef unsigned long TQ3EndCap;
  312.  
  313.  
  314. /******************************************************************************
  315.  **                                                                             **
  316.  **                        Point and Vector Definitions                         **
  317.  **                                                                             **
  318.  *****************************************************************************/
  319.  
  320. typedef struct TQ3Vector2D {
  321.     float        x;
  322.     float        y;
  323. } TQ3Vector2D;
  324.  
  325. typedef struct TQ3Vector3D {
  326.     float         x;
  327.     float        y;
  328.     float        z;
  329. } TQ3Vector3D;
  330.  
  331. typedef struct TQ3Point2D {
  332.     float        x;
  333.     float        y;
  334. } TQ3Point2D;
  335.  
  336. typedef struct TQ3Point3D {
  337.     float         x;
  338.     float        y;
  339.     float        z;
  340. } TQ3Point3D;
  341.  
  342. typedef struct TQ3RationalPoint4D {
  343.     float         x;
  344.     float        y;
  345.     float        z;
  346.     float        w;
  347. } TQ3RationalPoint4D;
  348.  
  349. typedef struct TQ3RationalPoint3D {
  350.     float        x;
  351.     float        y;
  352.     float        w;
  353. } TQ3RationalPoint3D;
  354.  
  355.  
  356. /******************************************************************************
  357.  **                                                                             **
  358.  **                                Quaternion                                     **
  359.  **                                                                             **
  360.  *****************************************************************************/
  361.  
  362. typedef struct TQ3Quaternion {
  363.     float        w;
  364.     float        x;
  365.     float        y;
  366.     float        z;
  367. } TQ3Quaternion;
  368.  
  369.  
  370. /******************************************************************************
  371.  **                                                                             **
  372.  **                                Ray Definition                                 **
  373.  **                                                                             **
  374.  *****************************************************************************/
  375.  
  376. typedef struct TQ3Ray3D {
  377.     TQ3Point3D        origin;
  378.     TQ3Vector3D        direction;
  379. } TQ3Ray3D;
  380.  
  381.  
  382. /******************************************************************************
  383.  **                                                                             **
  384.  **                        Parameterization Data Structures                     **
  385.  **                                                                             **
  386.  *****************************************************************************/
  387.  
  388. typedef struct TQ3Param2D {
  389.     float            u;
  390.     float            v;
  391. } TQ3Param2D;
  392.  
  393. typedef struct TQ3Param3D {
  394.     float            u;
  395.     float            v;
  396.     float            w;
  397. } TQ3Param3D;
  398.  
  399. typedef struct TQ3Tangent2D {
  400.     TQ3Vector3D        uTangent;
  401.     TQ3Vector3D        vTangent;
  402. } TQ3Tangent2D;
  403.  
  404. typedef struct TQ3Tangent3D {
  405.     TQ3Vector3D        uTangent;
  406.     TQ3Vector3D        vTangent;
  407.     TQ3Vector3D        wTangent;
  408. } TQ3Tangent3D;
  409.  
  410.  
  411. /******************************************************************************
  412.  **                                                                             **
  413.  **                        Polar and Spherical Coordinates                         **
  414.  **                                                                             **
  415.  *****************************************************************************/
  416.  
  417.  typedef struct TQ3PolarPoint {
  418.      float        r;
  419.      float        theta;
  420.   } TQ3PolarPoint;
  421.  
  422.  typedef struct TQ3SphericalPoint {
  423.      float        rho;
  424.      float        theta;
  425.      float        phi;
  426.  } TQ3SphericalPoint;
  427.  
  428.  
  429. /******************************************************************************
  430.  **                                                                             **
  431.  **                            Color Definition                                 **
  432.  **                                                                             **
  433.  *****************************************************************************/
  434.  
  435. typedef struct TQ3ColorRGB {
  436.     float             r;
  437.     float            g;
  438.     float            b;
  439. } TQ3ColorRGB;
  440.  
  441.  
  442. typedef struct TQ3ColorARGB {
  443.     float             a;
  444.     float             r;
  445.     float            g;
  446.     float            b;
  447. } TQ3ColorARGB;
  448.  
  449. /******************************************************************************
  450.  **                                                                             **
  451.  **                                    Vertices                                 **
  452.  **                                                                             **
  453.  *****************************************************************************/
  454.  
  455. typedef struct TQ3Vertex3D {
  456.     TQ3Point3D            point;
  457.     TQ3AttributeSet        attributeSet;
  458. }  TQ3Vertex3D;
  459.  
  460.  
  461. /******************************************************************************
  462.  **                                                                             **
  463.  **                                    Matrices                                 **
  464.  **                                                                             **
  465.  *****************************************************************************/
  466.  
  467. typedef struct TQ3Matrix3x3 {
  468.     float    value[3][3];
  469. } TQ3Matrix3x3;
  470.  
  471. typedef struct TQ3Matrix4x4 {
  472.     float    value[4][4];
  473. } TQ3Matrix4x4;
  474.  
  475.  
  476. /******************************************************************************
  477.  **                                                                             **
  478.  **                                Bitmap/Pixmap                                 **
  479.  **                                                                             **
  480.  *****************************************************************************/
  481.  
  482. typedef struct TQ3Pixmap {
  483.     void                *image;
  484.     unsigned long        width;
  485.     unsigned long        height;
  486.     unsigned long        rowBytes;
  487.     unsigned long        pixelSize;
  488.     TQ3PixelType        pixelType;
  489.     TQ3Endian            bitOrder;
  490.     TQ3Endian            byteOrder;
  491. } TQ3Pixmap;
  492.  
  493. typedef struct TQ3StoragePixmap {
  494.     TQ3StorageObject    image;
  495.     unsigned long        width;
  496.     unsigned long        height;
  497.     unsigned long        rowBytes;
  498.     unsigned long        pixelSize;
  499.     TQ3PixelType        pixelType;
  500.     TQ3Endian            bitOrder;
  501.     TQ3Endian            byteOrder;
  502. } TQ3StoragePixmap;
  503.  
  504. typedef struct TQ3Bitmap {
  505.     unsigned char        *image;
  506.     unsigned long        width;
  507.     unsigned long        height;
  508.     unsigned long        rowBytes;
  509.     TQ3Endian            bitOrder;
  510. } TQ3Bitmap;
  511.  
  512.  
  513. #ifdef __cplusplus
  514. extern "C" {
  515. #endif    /* __cplusplus */
  516.  
  517.  
  518. EXPORT TQ3Status Q3Bitmap_Empty(
  519.     TQ3Bitmap            *bitmap);
  520.  
  521. EXPORT unsigned long Q3Bitmap_GetImageSize(
  522.     unsigned long        width,
  523.     unsigned long        height);
  524.  
  525.  
  526. #ifdef __cplusplus
  527. }
  528. #endif    /* __cplusplus */
  529.  
  530.  
  531. /******************************************************************************
  532.  **                                                                             **
  533.  **                        Higher dimension quantities                             **
  534.  **                                                                             **
  535.  *****************************************************************************/
  536.  
  537. typedef struct TQ3Area {
  538.     TQ3Point2D             min;
  539.     TQ3Point2D             max;
  540. } TQ3Area;
  541.  
  542. typedef struct TQ3PlaneEquation {
  543.     TQ3Vector3D            normal;
  544.     float                constant;
  545. } TQ3PlaneEquation;
  546.  
  547. typedef struct TQ3BoundingBox {
  548.     TQ3Point3D             min;
  549.     TQ3Point3D             max;
  550.     TQ3Boolean            isEmpty;
  551. } TQ3BoundingBox;
  552.  
  553. typedef struct TQ3BoundingSphere {
  554.     TQ3Point3D            origin;
  555.     float                radius;
  556.     TQ3Boolean            isEmpty;
  557. } TQ3BoundingSphere;
  558.  
  559. /*
  560.  *    The TQ3ComputeBounds flag passed to BoundingBox or BoundingSphere
  561.  *    calls is a hint to the system as to how it should 
  562.  *    compute the bbox of a shape:
  563.  *
  564.  *    kQ3ComputeBoundsExact:    
  565.  *        Vertices of shapes are transformed into world space and
  566.  *        the world space bounding box is computed from them.  Slow!
  567.  *    
  568.  *    kQ3ComputeBoundsApproximate: 
  569.  *        A local space bounding box is computed from a shape's
  570.  *        vertices.  This bbox is then transformed into world space,
  571.  *        and its bounding box is taken as the shape's approximate
  572.  *        bbox.  Fast but the bbox is larger than optimal.
  573.  */
  574.  
  575. typedef enum TQ3ComputeBounds {
  576.     kQ3ComputeBoundsExact,
  577.     kQ3ComputeBoundsApproximate
  578. } TQ3ComputeBounds;
  579.  
  580.  
  581. /******************************************************************************
  582.  **                                                                             **
  583.  **                            Object System Types                                 **
  584.  **                                                                             **
  585.  *****************************************************************************/
  586.  
  587. typedef struct TQ3ObjectClassPrivate        *TQ3ObjectClass;
  588.  
  589. typedef unsigned long                         TQ3MethodType;
  590.  
  591. /*
  592.  * Object methods
  593.  */
  594. #define kQ3MethodTypeObjectDuplicate        Q3_METHOD_TYPE('d','u','p','l')
  595. #define kQ3MethodTypeObjectDelete            Q3_METHOD_TYPE('d','l','t','e')
  596. #define kQ3MethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  597. #define kQ3MethodTypeObjectDraw                Q3_METHOD_TYPE('d','r','a','w')
  598.  
  599. /*
  600.  * IO Methods
  601.  */
  602. #define kQ3MethodTypeObjectFileVersion        Q3_METHOD_TYPE('v','e','r','s') /* version */
  603.  
  604. #define kQ3MethodTypeObjectTraverse            Q3_METHOD_TYPE('t','r','v','s') /* byte count */
  605. #define kQ3MethodTypeObjectWrite            Q3_METHOD_TYPE('w','r','i','t') /* Dump info to file */
  606. #define kQ3MethodTypeObjectRead                Q3_METHOD_TYPE('r','e','a','d') /* Read info from file, create object */
  607. #define kQ3MethodTypeObjectReadData            Q3_METHOD_TYPE('r','d','d','t') /* Read info from file into buffer or, attach read data to parent */ 
  608. #define kQ3MethodTypeObjectAttach            Q3_METHOD_TYPE('a','t','t','c') /* Attach one read object to another */
  609.  
  610. typedef void (*TQ3FunctionPointer)(
  611.     void);
  612.  
  613. typedef TQ3FunctionPointer (*TQ3MetaHandler)(
  614.     TQ3MethodType        methodType);
  615.  
  616. /*
  617.  * MetaHandler:
  618.  *        When you give a metahandler to QuickDraw 3D, it is called multiple times to
  619.  *        build method tables, and then is thrown away. You are guaranteed that
  620.  *        your metahandler will never be called again after a call that was passed
  621.  *        a metahandler returns.
  622.  *
  623.  *        Your metahandler should contain a switch on the methodType passed to it
  624.  *        and should return the corresponding method as an TQ3FunctionPointer.
  625.  *
  626.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  627.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  628.  *
  629.  *        These types here are prototypes of how your functions should look.
  630.  */
  631.  
  632. typedef TQ3Status (*TQ3ObjectDeleteMethod)(
  633.     TQ3Object            object);
  634.  
  635. typedef TQ3Object (*TQ3ObjectDuplicateMethod)(
  636.     TQ3Object            object);
  637.  
  638. typedef TQ3Status (*TQ3ObjectUnregisterMethod)(
  639.     TQ3ObjectClass        objectClass);
  640.     
  641. typedef TQ3Status (*TQ3ObjectDrawMethod)(
  642.     TQ3Object            object,
  643.     TQ3ViewObject        view);
  644.  
  645. /*
  646.  * See QD3DIO.h for the IO method types: 
  647.  *        ObjectRead, ObjectReadData, ObjectAttach, ObjectTraverse, ObjectWrite
  648.  */
  649.  
  650. /******************************************************************************
  651.  **                                                                             **
  652.  **                            Object System Macros                             **
  653.  **                                                                             **
  654.  *****************************************************************************/
  655.  
  656. #define Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d)         \
  657.             ((const unsigned long)                     \
  658.             ((const unsigned long) (a) << 24) |     \
  659.             ((const unsigned long) (b) << 16) |        \
  660.             ((const unsigned long) (c) << 8)  |     \
  661.             ((const unsigned long) (d)))
  662.  
  663. #define Q3_OBJECT_TYPE(a,b,c,d) ((TQ3ObjectType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  664. #define Q3_METHOD_TYPE(a,b,c,d) ((TQ3MethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  665.  
  666.  
  667. /******************************************************************************
  668.  **                                                                             **
  669.  **                                Object Types                                 **
  670.  **                                                                             **
  671.  *****************************************************************************/
  672.  
  673. /*
  674.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  675.  *            e.g. Q3Shared_GetType(janeObject) returns kQ3SharedTypeShape, etc.
  676.  */
  677. #define kQ3ObjectTypeInvalid                            0
  678. #define kQ3ObjectTypeView                                Q3_OBJECT_TYPE('v','i','e','w')
  679.     #if defined(ESCHER_VER_15) && ESCHER_VER_15
  680.     #define kQ3ViewTypeUIView                            Q3_OBJECT_TYPE('u','i','v','w')
  681.     #endif  /*  ESCHER_VER_15  */
  682. #define kQ3ObjectTypeElement                            Q3_OBJECT_TYPE('e','l','m','n')
  683.     #define kQ3ElementTypeAttribute                        Q3_OBJECT_TYPE('e','a','t','t')
  684. #define kQ3ObjectTypePick                                Q3_OBJECT_TYPE('p','i','c','k')
  685.     #define kQ3PickTypeWindowPoint                        Q3_OBJECT_TYPE('p','k','w','p')
  686.     #define kQ3PickTypeWindowRect                        Q3_OBJECT_TYPE('p','k','w','r')
  687.     #if defined(ESCHER_VER_15) && ESCHER_VER_15
  688.     #define kQ3PickTypeBox                                Q3_OBJECT_TYPE('p','k','b','x')
  689.     #define kQ3PickTypeRay                                Q3_OBJECT_TYPE('p','k','r','y')
  690.     #define kQ3PickTypeSphere                            Q3_OBJECT_TYPE('p','k','s','p')
  691.     #endif  /*  ESCHER_VER_15  */
  692. #define kQ3ObjectTypeShared                                Q3_OBJECT_TYPE('s','h','r','d')
  693.     #define kQ3SharedTypeRenderer                        Q3_OBJECT_TYPE('r','d','d','r')
  694.         #define kQ3RendererTypeWireFrame                Q3_OBJECT_TYPE('w','r','f','r')
  695.         #if defined(ESCHER_VER_15) && ESCHER_VER_15
  696.         #define kQ3RendererTypeZBuffer                    Q3_OBJECT_TYPE('z','b','u','f')
  697.         #endif
  698.         #define kQ3RendererTypeGeneric                    Q3_OBJECT_TYPE('g','n','r','r')
  699.         #define kQ3RendererTypeEmpty                    Q3_OBJECT_TYPE('e','m','t','r')
  700.         #define kQ3RendererTypeInteractive                Q3_OBJECT_TYPE('c','t','w','n')
  701.     #define kQ3SharedTypeShape                            Q3_OBJECT_TYPE('s','h','a','p')
  702.         #define kQ3ShapeTypeGeometry                    Q3_OBJECT_TYPE('g','m','t','r')
  703.             #define kQ3GeometryTypeBox                    Q3_OBJECT_TYPE('b','o','x',' ')
  704.             #define kQ3GeometryTypeGeneralPolygon        Q3_OBJECT_TYPE('g','p','g','n')
  705.             #define kQ3GeometryTypeLine                    Q3_OBJECT_TYPE('l','i','n','e')
  706.             #define kQ3GeometryTypeMarker                Q3_OBJECT_TYPE('m','r','k','r')
  707.             #define kQ3GeometryTypeMesh                    Q3_OBJECT_TYPE('m','e','s','h')
  708.             #define kQ3GeometryTypeNURBCurve            Q3_OBJECT_TYPE('n','r','b','c')
  709.             #define kQ3GeometryTypeNURBPatch            Q3_OBJECT_TYPE('n','r','b','p')
  710.             #define kQ3GeometryTypePoint                Q3_OBJECT_TYPE('p','n','t',' ')
  711.             #define kQ3GeometryTypePolygon                Q3_OBJECT_TYPE('p','l','y','g')
  712.             #define kQ3GeometryTypeTriangle                Q3_OBJECT_TYPE('t','r','n','g')
  713.             #define kQ3GeometryTypeTriGrid                Q3_OBJECT_TYPE('t','r','i','g')
  714.             #if defined(ESCHER_VER_15) && ESCHER_VER_15
  715.             #define kQ3GeometryTypeCone                    Q3_OBJECT_TYPE('c','o','n','e')
  716.             #define kQ3GeometryTypeCylinder                Q3_OBJECT_TYPE('c','y','l','n')
  717.             #define kQ3GeometryTypeDisk                    Q3_OBJECT_TYPE('d','i','s','k')
  718.             #define kQ3GeometryTypeEllipse                Q3_OBJECT_TYPE('e','l','p','s')
  719.             #define kQ3GeometryTypeEllipsoid            Q3_OBJECT_TYPE('e','l','p','d')
  720.             #define kQ3GeometryTypePolyLine                Q3_OBJECT_TYPE('p','l','y','l')
  721.             #define kQ3GeometryTypeTorus                Q3_OBJECT_TYPE('t','o','r','s')
  722.             #endif  /*  ESCHER_VER_15  */
  723.         #define kQ3ShapeTypeShader                        Q3_OBJECT_TYPE('s','h','d','r')
  724.             #define kQ3ShaderTypeSurface                Q3_OBJECT_TYPE('s','u','s','h')
  725.                 #define kQ3SurfaceShaderTypeTexture        Q3_OBJECT_TYPE('t','x','s','u')
  726.             #define kQ3ShaderTypeIllumination            Q3_OBJECT_TYPE('i','l','s','h')
  727.                 #define kQ3IlluminationTypePhong        Q3_OBJECT_TYPE('p','h','i','l')
  728.                 #define kQ3IlluminationTypeLambert        Q3_OBJECT_TYPE('l','m','i','l')
  729.                 #define kQ3IlluminationTypeNULL            Q3_OBJECT_TYPE('n','u','i','l')
  730.             #if defined(ESCHER_VER_15) && ESCHER_VER_15
  731.             #define kQ3ShaderTypeImage                    Q3_OBJECT_TYPE('i','m','s','h')
  732.             #define kQ3ShaderTypeTrim                    Q3_OBJECT_TYPE('t','r','s','h')
  733.             #define kQ3ShaderTypeAtmospheric            Q3_OBJECT_TYPE('a','t','s','h')
  734.             #endif  /*  ESCHER_VER_15  */
  735.         #define kQ3ShapeTypeStyle                        Q3_OBJECT_TYPE('s','t','y','l')
  736.             #define kQ3StyleTypeBackfacing                Q3_OBJECT_TYPE('b','c','k','f')
  737.             #define kQ3StyleTypeInterpolation            Q3_OBJECT_TYPE('i','n','t','p')
  738.             #define kQ3StyleTypeFill                    Q3_OBJECT_TYPE('f','i','s','t')
  739.             #define kQ3StyleTypePickID                    Q3_OBJECT_TYPE('p','k','i','d')
  740.             #define kQ3StyleTypeReceiveShadows            Q3_OBJECT_TYPE('r','c','s','h')
  741.             #define kQ3StyleTypeHighlight                Q3_OBJECT_TYPE('h','i','g','h')
  742.             #define kQ3StyleTypeSubdivision                Q3_OBJECT_TYPE('s','b','d','v')
  743.             #define kQ3StyleTypeOrientation                Q3_OBJECT_TYPE('o','f','d','r')
  744.             #define kQ3StyleTypePickParts                Q3_OBJECT_TYPE('p','k','p','t')
  745.         #define kQ3ShapeTypeTransform                    Q3_OBJECT_TYPE('x','f','r','m')
  746.             #define kQ3TransformTypeMatrix                Q3_OBJECT_TYPE('m','t','r','x')
  747.             #define kQ3TransformTypeScale                Q3_OBJECT_TYPE('s','c','a','l')
  748.             #define kQ3TransformTypeTranslate            Q3_OBJECT_TYPE('t','r','n','s')
  749.             #define kQ3TransformTypeRotate                Q3_OBJECT_TYPE('r','o','t','t')
  750.             #define kQ3TransformTypeRotateAboutPoint     Q3_OBJECT_TYPE('r','t','a','p')
  751.             #define kQ3TransformTypeRotateAboutAxis     Q3_OBJECT_TYPE('r','t','a','a')
  752.             #define kQ3TransformTypeQuaternion            Q3_OBJECT_TYPE('q','t','r','n')
  753.         #define kQ3ShapeTypeLight                        Q3_OBJECT_TYPE('l','g','h','t')
  754.             #define kQ3LightTypeAmbient                    Q3_OBJECT_TYPE('a','m','b','n')
  755.             #define kQ3LightTypeDirectional                Q3_OBJECT_TYPE('d','r','c','t')
  756.             #define kQ3LightTypePoint                    Q3_OBJECT_TYPE('p','n','t','l')
  757.             #define kQ3LightTypeSpot                    Q3_OBJECT_TYPE('s','p','o','t')
  758.         #define kQ3ShapeTypeCamera                        Q3_OBJECT_TYPE('c','m','r','a')
  759.             #define kQ3CameraTypeOrthographic            Q3_OBJECT_TYPE('o','r','t','h')
  760.             #define kQ3CameraTypeViewPlane                Q3_OBJECT_TYPE('v','w','p','l')
  761.             #define kQ3CameraTypeViewAngleAspect        Q3_OBJECT_TYPE('v','a','n','a')
  762.         #define kQ3ShapeTypeGroup                        Q3_OBJECT_TYPE('g','r','u','p')
  763.             #define kQ3GroupTypeDisplay                    Q3_OBJECT_TYPE('d','s','p','g')
  764.                 #define kQ3DisplayGroupTypeOrdered        Q3_OBJECT_TYPE('o','r','d','g')
  765.                 #define kQ3DisplayGroupTypeIOProxy        Q3_OBJECT_TYPE('i','o','p','x')
  766.             #define kQ3GroupTypeLight                    Q3_OBJECT_TYPE('l','g','h','g')
  767.             #define kQ3GroupTypeInfo                    Q3_OBJECT_TYPE('i','n','f','o')
  768.         #define kQ3ShapeTypeUnknown                        Q3_OBJECT_TYPE('u','n','k','n')
  769.             #define kQ3UnknownTypeText                        Q3_OBJECT_TYPE('u','k','t','x')
  770.             #define kQ3UnknownTypeBinary                    Q3_OBJECT_TYPE('u','k','b','n')
  771.     #define kQ3SharedTypeSet                            Q3_OBJECT_TYPE('s','e','t',' ')
  772.         #define kQ3SetTypeAttribute                        Q3_OBJECT_TYPE('a','t','t','r')
  773.     #define kQ3SharedTypeDrawContext                    Q3_OBJECT_TYPE('d','c','t','x')
  774.         #define kQ3DrawContextTypePixmap                Q3_OBJECT_TYPE('d','p','x','p')
  775.         #define kQ3DrawContextTypeMacintosh                Q3_OBJECT_TYPE('d','m','a','c')
  776.         #if defined(ESCHER_VER_15) && ESCHER_VER_15
  777.         #define kQ3DrawContextTypeWindows                Q3_OBJECT_TYPE('d','w','i','n')
  778.         #define kQ3DrawContextTypeX11                    Q3_OBJECT_TYPE('d','x','1','1')
  779.         #define kQ3DrawContextTypeFile                    Q3_OBJECT_TYPE('d','f','i','l')
  780.         #endif  /*  ESCHER_VER_15  */
  781.     #define kQ3SharedTypeTexture                        Q3_OBJECT_TYPE('t','x','t','r')
  782.         #define kQ3TextureTypePixmap                    Q3_OBJECT_TYPE('t','x','p','m')
  783.         #if defined(ESCHER_VER_15) && ESCHER_VER_15
  784.         #define kQ3TextureTypeQuickdrawGX                Q3_OBJECT_TYPE('t','x','g','x')
  785.         #endif  /*  ESCHER_VER_15  */
  786.     #if defined(ESCHER_VER_15) && ESCHER_VER_15
  787.     #define kQ3SharedTypeAttachment                        Q3_OBJECT_TYPE('a','t','c','h')
  788.     #endif  /*  ESCHER_VER_15  */
  789.     #define kQ3SharedTypeFile                            Q3_OBJECT_TYPE('f','i','l','e')
  790.     #define kQ3SharedTypeStorage                        Q3_OBJECT_TYPE('s','t','r','g')
  791.         #define kQ3StorageTypeMemory                    Q3_OBJECT_TYPE('m','e','m','s')
  792.             #define kQ3MemoryStorageTypeHandle            Q3_OBJECT_TYPE('h','n','d','l')
  793.         #define kQ3StorageTypeUnix                        Q3_OBJECT_TYPE('u','x','s','t')
  794.             #define kQ3UnixStorageTypePath                Q3_OBJECT_TYPE('u','n','i','x')
  795.         #define kQ3StorageTypeMacintosh                    Q3_OBJECT_TYPE('m','a','c','n')
  796.             #define kQ3MacintoshStorageTypeFSSpec        Q3_OBJECT_TYPE('m','a','c','p')                    
  797.     #define kQ3SharedTypeReference                        Q3_OBJECT_TYPE('r','f','r','n')
  798.     #define kQ3SharedTypeString                            Q3_OBJECT_TYPE('s','t','r','n')
  799.         #define kQ3StringTypeCString                    Q3_OBJECT_TYPE('s','t','r','c')
  800.         #if defined(ESCHER_VER_15) && ESCHER_VER_15
  801.         #define kQ3StringTypeUnicode                    Q3_OBJECT_TYPE('u','n','c','d')
  802.         #define kQ3StringTypeWorldScript                Q3_OBJECT_TYPE('s','c','r','p')
  803.         #endif  /*  ESCHER_VER_15  */
  804.     #define kQ3SharedTypeShapePart                        Q3_OBJECT_TYPE('s','p','r','t')
  805.         #define kQ3ShapePartTypeMeshPart                Q3_OBJECT_TYPE('s','p','m','h')
  806.             #define kQ3MeshPartTypeMeshFacePart            Q3_OBJECT_TYPE('m','f','a','c')
  807.             #define kQ3MeshPartTypeMeshEdgePart            Q3_OBJECT_TYPE('m','e','d','g')
  808.             #define kQ3MeshPartTypeMeshVertexPart        Q3_OBJECT_TYPE('m','v','t','x')
  809.     #define kQ3SharedTypeControllerState                Q3_OBJECT_TYPE('c','t','s','t')
  810.     #define kQ3SharedTypeTracker                        Q3_OBJECT_TYPE('t','r','k','r')
  811.     #define kQ3SharedTypeViewHints                        Q3_OBJECT_TYPE('v','w','h','n')
  812.     #define kQ3SharedTypeDrawContextHints                Q3_OBJECT_TYPE('d','c','h','n')
  813.     #if defined(ESCHER_VER_15) && ESCHER_VER_15
  814.     #define kQ3SharedTypeDeepBuffer                        Q3_OBJECT_TYPE('d','e','e','p')
  815.     #define kQ3SharedTypeWidget                            Q3_OBJECT_TYPE('w','d','g','t')
  816.     #define kQ3SharedTypeColorScheme                    Q3_OBJECT_TYPE('c','s','c','h')
  817.     #endif  /*  ESCHER_VER_15  */
  818.  
  819.  
  820. #ifdef __cplusplus
  821. extern "C" {
  822. #endif    /* __cplusplus */
  823.  
  824. /******************************************************************************
  825.  **                                                                             **
  826.  **                            QuickDraw 3D System Routines                     **
  827.  **                                                                             **
  828.  *****************************************************************************/
  829.  
  830. EXPORT TQ3Status Q3Initialize(
  831.     void);
  832.  
  833. EXPORT TQ3Status Q3Exit(
  834.     void);
  835.  
  836. EXPORT TQ3Boolean Q3IsInitialized(
  837.     void);
  838.  
  839. EXPORT TQ3Status Q3GetVersion(
  840.     unsigned long        *majorRevision,
  841.     unsigned long        *minorRevision);
  842.  
  843.  
  844. /******************************************************************************
  845.  **                                                                             **
  846.  **                            ObjectClass Routines                             **
  847.  **                                                                             **
  848.  *****************************************************************************/
  849.  
  850. EXPORT TQ3Status Q3ObjectClass_Unregister(
  851.     TQ3ObjectClass        objectClass);
  852.  
  853.  
  854. /******************************************************************************
  855.  **                                                                             **
  856.  **                                Object Routines                                 **
  857.  **                                                                             **
  858.  *****************************************************************************/
  859.  
  860. EXPORT TQ3Status Q3Object_Dispose(
  861.     TQ3Object             object);
  862.     
  863. EXPORT TQ3Object Q3Object_Duplicate(
  864.     TQ3Object            object);
  865.     
  866. EXPORT TQ3Status Q3Object_Submit(
  867.     TQ3Object            object,
  868.     TQ3ViewObject        view);
  869.     
  870. EXPORT TQ3Boolean Q3Object_IsDrawable(
  871.     TQ3Object            object);
  872.  
  873.  
  874. /******************************************************************************
  875.  **                                                                             **
  876.  **                            Object Type Routines                             **
  877.  **                                                                             **
  878.  *****************************************************************************/
  879.  
  880. EXPORT TQ3ObjectType Q3Object_GetType(
  881.     TQ3Object            object);
  882.  
  883. EXPORT TQ3ObjectType Q3Object_GetLeafType(
  884.     TQ3Object            object);
  885.  
  886. EXPORT TQ3Boolean Q3Object_IsType(
  887.     TQ3Object            object,
  888.     TQ3ObjectType        type);
  889.  
  890.  
  891. /******************************************************************************
  892.  **                                                                             **
  893.  **                            Shared Object Routines                             **
  894.  **                                                                             **
  895.  *****************************************************************************/
  896.  
  897. EXPORT TQ3ObjectType Q3Shared_GetType(
  898.     TQ3SharedObject     sharedObject);
  899.  
  900. EXPORT TQ3SharedObject Q3Shared_GetReference(
  901.     TQ3SharedObject     sharedObject);
  902.  
  903.  
  904. /******************************************************************************
  905.  **                                                                             **
  906.  **                                Shape Routines                                 **
  907.  **                                                                             **
  908.  *****************************************************************************/
  909.  
  910. EXPORT TQ3ObjectType Q3Shape_GetType(
  911.     TQ3ShapeObject    shape);
  912.  
  913. EXPORT TQ3Status Q3Shape_GetSet(
  914.     TQ3ShapeObject    shape,
  915.     TQ3SetObject    *set);
  916.  
  917. EXPORT TQ3Status Q3Shape_SetSet(
  918.     TQ3ShapeObject    shape,
  919.     TQ3SetObject     set);
  920.  
  921.  
  922. #ifdef __cplusplus
  923. }
  924. #endif  /*  __cplusplus  */
  925.  
  926. #endif /*  QD3D_h  */
  927.